package test

import spray.json._


import scala.collection.Map

/**
 * Created by root on 2015/3/30.
 */
case class Color(name: String, red: Int, green: Int, blue: Int)
class test {

}
class  Person(name:String,age:Int)
class  Student(num:Int,name:String,age:Int) extends  Person(name:String,age:Int)

case  class  User(num:Int,p:Person)
object MyJsonProtocol extends DefaultJsonProtocol {
  implicit val colorFormat = jsonFormat4(Color)
}
object test{



  def main(args: Array[String]) {

    import MyJsonProtocol._

    val json = Color("CadetBlue", 95, 158, 160).toJson
    val color = json.convertTo[Color]
     println(json)
     println(color)
   val s= new User(10,new Person("aa",23))


  }

}